import request from '@/utils/request'

// 根据角色分配菜单请求方法
export const DoAssignMenuIdToSysRole = assignMenuDto => {
  return request({
    url: '/admin/system/roleMenu/doAssign',
    method: 'post',
    data: assignMenuDto,
  })
}

// 查询指定角色所对应的菜单id
export const GetSysRoleMenuIds = roleId => {
  return request({
    url: `/admin/system/roleMenu/findSysRoleMenuByRoleId/${roleId}`,
    method: 'get',
  })
}

// 分页查询角色数据
export const GetSysRoleListByPage = (pageNum, pageSize, queryDto) => {
  return request({
    url: `/admin/system/role/${pageNum}/${pageSize}`,
    method: 'get',
    params: queryDto,
  })
}

// 添加角色请求方法
export const SaveSysRole = data => {
  return request({
    url: '/admin/system/role/save',
    method: 'post',
    data,
  })
}

// 保存修改
export const UpdateSysRole = data => {
  return request({
    url: '/admin/system/role/update',
    method: 'put',
    data,
  })
}

// 删除角色
export const DeleteSysRoleById = id => {
  return request({
    url: `/admin/system/role/remove/${id}`,
    method: 'delete',
  })
}

// 查询所有的角色数据
export const GetAllRoleList = userId => {
  return request({
    url: `/admin/system/role/findAllRoles/${userId}`,
    method: 'get',
  })
}
